﻿<?php

include("class.base.php");

if (isset($_POST["login"])) {
	$paring = mysql_query("SELECT * FROM kasutaja WHERE email='".htmlspecialchars($_POST["email"])."' AND parool='".md5(md5($_POST["parool"]."tvp"))."'");
	if (mysql_num_rows($paring) != 1) { $viga = "Email või parool on vale. Proovi uuesti."; }
	else { $_SESSION["kindred"] = mysql_fetch_array($paring); }
}

if (!sisse_logitud()) {
$pealkiri1 = "Logi sisse";
$sisu =<<<SISU
<form action="" method="POST">
<table width="100%">
<tr><td width="100">Email</td><td><input type="text" name="email"></td></tr>
<tr><td>Parool</td><td><input type="password" name="parool"></td></tr>
<tr><td></td><td><input type="submit" name="login" value="Logi sisse"></td></tr>
</table>
</form>
SISU;
}
else {
$pealkiri1 = "Avaleht";
$sisu =<<<SISU
SISU;
}

include("kujundus.php");
?>
